package com.itqf.quartz02;

import org.quartz.Job;
import org.quartz.JobExecutionContext;
import org.quartz.JobExecutionException;

import java.text.SimpleDateFormat;
import java.util.Date;

/**
 * @Description:
 * @Company: 千锋互联
 * @Author: 李丽婷
 * @Date: 2021/1/26
 * @Time: 上午11:16
 */
public class MyJob implements Job {

    /**
     *
     * @param jobExecutionContext 上下文  创建定时任务 可以向任务传值
     * @throws JobExecutionException
     */
    @Override
    public void execute(JobExecutionContext jobExecutionContext) throws JobExecutionException {
        System.out.println("jobName:"+jobExecutionContext.getJobDetail().getKey());
        System.out.println("data:"+jobExecutionContext.getJobDetail().getJobDataMap().get("name"));
        System.out.println(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss").format(new Date()) +":helloworld!");

    }
}
